{template header}
<link rel="stylesheet" href="/static/calendar/js/calendar.css" />
<script type="text/javascript" charset="utf-8" src="/static/calendar/calendar.php"></script>
<link rel="stylesheet" href="/static/kindeditor/themes/default/default.css" />
<script charset="utf-8" src="/static/kindeditor/kindeditor-min.js"></script>
<script charset="utf-8" src="/static/kindeditor/lang/zh_CN.js"></script>

<script type="text/javascript">
    $(function () {
        KindEditor.ready(function(K) {
            K.create('textarea[name="introduce"]', {
                allowFileManager : true,
                uploadJson: './index.php?c=admin&a=uploadKindEditorImg',
                newlineTag:'p',
                filterMode : true,
                htmlTags:{
                    p : ['style','color', 'align', 'class'],
                    font : ['style','color', 'size', 'face', 'class'],
                    span : ['style','style','color', 'align'],
                    div : ['style','class', 'align'],
                    a : ['style','class', 'href', 'target', 'name'],
                    embed : ['style','src', 'width', 'height', 'type', 'loop', 'autostart', 'quality',
                    'style', 'align', 'allowscriptaccess', '/'],
                    img : ['style','src', 'width', 'height', 'border', 'alt', 'title', 'align', 'style','data-source','/', 'class'],
                    hr : ['style','class', '/'],
                    br : ['/'],
                    'ol,ul,li,blockquote,h1,h2,h3,h4,h5,h6' : ['style','align'],
                    'dl,dt,dd,tbody,tr,strong,b,sub,sup,em,i,u,strike,section' : ['style', 'class'],
                },
                afterBlur: function(){this.sync();}
            });
        });        
	
        //表单提交
        $('.form-horizontal').on('submit', function() {
            
        });
	
    });
</script>
    
<div class="container-fluid">
  <form enctype="multipart/form-data" method="post" action="/index.php?c=actLottery&a=lotteryaddedit" class="form-horizontal">
    <div class="control-group">
        <label class="control-label">标题：</label>
        <div class="controls">
            <input class="input-xxlarge" type="text" name='title' placeholder="请输入活动标题" value="{$viewDatas['title']}">
        </div>
    </div>
      
    <div class="control-group">
        <label class="control-label">规则介绍：</label> 
        <div class="controls">
            <textarea rows="10" name="introduce" style="width:800px; min-height:200x;">
                {if $viewDatas['introduce']}
                    {$viewDatas['introduce']}
                {else}
                    <dl>
                        <dt>一、活动时间：2015.6.17—2015.6.20</dt>
                        <dt>二、活动玩法：</dt>
                        <dd>
                            <p>1.邀请你的好友助力，一个好友助力获得一个能量值巴拉拉啦工;</p>
                            <p>2.能量值分为180、100、50、25、10五个等级如果我输入法;</p>
                            <p>3.每人每天可以为很多好友助力，但是针对没经验好节天与没劲;</p>
                        </dd>
                        <dt>三、活动奖品</dt>
                        <dd>1.一等奖（价值1500-2500元）：Apple Watch/颂拓手表</dd>
                    </dl>
                {/if}
            </textarea>
        </div>
    </div>
     	
    <div class="control-group">
        <label class="control-label">奖项文字描述：</label>
        <div class="controls">
            <textarea rows="5" name="awarddesc" style="width:500px;">{eval if ($viewDatas['award_desc']) echo implode(',', json_decode($viewDatas['award_desc'], true));}</textarea>
            <p>英文（,）逗号隔开每个奖项，每行一个，一等奖、二等奖...依次填写，如apple watch,跑鞋,运动衫...(分别代表一等奖，二等奖，三等奖奖品...)</p>
            <p>如果是虚拟物品，请在文字描述后加上##后跟外链地址，如：某某点20优惠券##http:xxx</p>
        </div>
    </div>
      
    <div class="control-group">
        <label class="control-label">奖项转盘映射：</label>
        <div class="controls">
            <textarea rows="2" name="mapinfo" style="width:200px;">{$viewDatas['adRotMap']}</textarea>
            <p>第一项表示未中奖信息，第二项表示一等奖，依次类推,每项已冒号(:)隔开。一个奖项的多个块之间逗号(,)分隔</p>
            <p>例：1,3,5,7,9:2:8:10:4:6（分别表示1,3,5,7,9为未中奖扇形块，2为一等奖..）</p>
        </div>
    </div>
      
    <div class="control-group">
        <label class="control-label">奖品图：</label>
        <div class="controls">
            {if $viewDatas['award_img']}
                <img style="max-height:200px;" src="$viewDatas['award_img']" alt="奖品图">
            {/if}    
            <input type="file" name="awardimg">
        </div>
    </div>
      
    <div class="control-group">
        <label class="control-label">转盘图：</label>
        <div class="controls">
            {if $viewDatas['rotate_img']}
                <img style="max-height:200px;" src="$viewDatas['rotate_img']" alt="转盘图">
            {/if}
            <input type="file" name="rotateimg">
        </div>
    </div>
      
    <div class="control-group">
        <label class="control-label">初始参赛人数：</label>
        <div class="controls">
			<input type="text" style="width: 100px" value="$viewDatas['init_joins']" placeholder="初始参赛人数" name="init_joins">
        </div>
    </div>
      
    <div class="control-group">
        <label class="control-label">初始抽奖码发放数：</label>
        <div class="controls">
			<input type="text" style="width: 100px" value="$viewDatas['init_code_provide']" placeholder="初始抽奖码发放数" name="init_code_provide">
        </div>
    </div>

    <div class="control-group">
        <label class="control-label">开始时间：</label>
        <div class="controls">
        <input type="text" name="starttime" id="start_time_id" value="{eval if($viewDatas['start_time']) echo date('Y-m-d H:i:s', $viewDatas['start_time']); else echo date('Y-m-d H:i:s', time());}">
            <input type="button" id="start_time_btn" onclick="return showCalendar('start_time_id', '%Y-%m-%d %H:%M:%S', '24', false, 'start_time_btn');" value="选择" class="button" id="start_time_id"/>
        </div>
    </div>
      
    <div class="control-group">
        <label class="control-label">结束时间：</label>
        <div class="controls">
        <input type="text" name="endtime" id="end_time_id" value="{eval if ($viewDatas['end_time']) echo date('Y-m-d H:i:s', $viewDatas['end_time']); else echo date('Y-m-d H:i:s', time());}">
            <input type="button" id="end_time_btn" onclick="return showCalendar('end_time_id', '%Y-%m-%d %H:%M:%S', '24', false, 'end_time_btn');" value="选择" class="button" id="end_time_id"/>
        </div>
    </div>  
      
    <div class="control-group">
        <div class="controls">
            <input type="hidden" name="lotteryId" value="{$viewDatas['id']}">
            <button type="submit" class="btn">提交</button>
            {if {$viewDatas['id']}}
                <a class="btn" href="/?c=actLottery&a=codeInfo&lid={$viewDatas['id']}">查看/添加抽奖码</a>
            {/if}
        </div>
    </div>
  </form>
</div>
{template footer}